package traveller.dbUtils;

import java.util.ArrayList;

import readers.StarsReader;
import util.RunPoperties;
import beans.Star;
import db.dao.StarsDAO;

public class UploadStars {
	private String path="";

	public UploadStars(String path) {
		this.path=path;
	}

	public static void main(String[] args) throws Exception {
		
		RunPoperties runPoperties = new RunPoperties(args);
		runPoperties.loadProps();
		String path = runPoperties.getString("path");
		
		
		UploadStars uploadStars= new UploadStars(path);
		uploadStars.process();		
		
	}

	private void process() throws Exception {
		StarsReader sr = new StarsReader(path);
		sr.process();
		ArrayList<Star> starList = sr.getArray();
		System.out.println(starList.size());
		StarsDAO starsDAO= StarsDAO.getIstance();	
		starsDAO.recordStarsLast(starList);
	}
}
